import { ctx } from '../../entrance/inter';
import get from './get'
import post from './post'
import url from './url'
import other from './other';

//解析请求
if(module) module.exports = param;
export default async function param(ctx:ctx){
    // 原生
    ctx.req.url = url(ctx.req.url);
    //存储请求的浏览器信息
    switch (ctx.req.method) {
        case "GET"  : return get(ctx);
        case "POST" : return post(ctx,param.MAXSIZE);
        case "PUT"  : 
        case "DELETE": 
        case "OPTIONS" : return other(ctx,param.MAXSIZE);
        default     : return false;
    }
}

param.MAXSIZE = 1024*1024*1024*20;
